/**
 * 只有L型的方块，给定落下的情况，求8列最后的高度。
 * 模拟处理每一种下落即可
 */
#include <bits/stdc++.h>
using namespace std;

#include <bits/extc++.h>
using namespace __gnu_pbds;


using llt = long long;
using Real = double;
using vi = vector<int>;
using pii = pair<int, int>;

int N;
vector<pii> A;

vi H;

void proc0(int c){
    c -= 1;
    assert(0 <= c and c + 1 < 8);
    int t = max(H[c], H[c + 1]);
    H[c] = t + 3;
    H[c + 1] = t + 1;
    return;
}

void proc90(int c){
    c -= 1;
    assert(0 <= c and c + 2 < 8);
    int t = max(H[c] + 1, max(H[c + 1], H[c + 2]));
    H[c] = H[c + 1] = H[c + 2] = t + 1;
    return;
}

void proc180(int c){
    c -= 1;
    assert(0 <= c and c + 1 < 8);
    int t = max(H[c] + 1, H[c + 1] + 3);
    H[c] = H[c + 1] = t;
    return;
}

void proc270(int c){
    c -= 1;
    assert(0 <= c and c + 2 < 8);
    int t = max(H[c], max(H[c + 1], H[c + 2]));
    H[c] = H[c + 1] = t + 1;
    H[c + 2] = t + 2;
    return;
}

void proc(){
    H.assign(8, 0);
    for(const auto & p : A){
        if(p.first == 0) proc0(p.second);
        else if(p.first == 90) proc90(p.second);
        else if(p.first == 180) proc180(p.second);
        else if(p.first == 270) proc270(p.second);
        else assert(0);
    }
    for(auto i : H) cout << i << " ";
    cout << "\n";
    return;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(0);
    int nofkase = 1;
    // cin >> nofkase;
    while(nofkase--){
        cin >> N;
        A.assign(N, {});
        for(auto & p : A) cin >> p.first >> p.second;
        proc();
    }
    return 0;
}